import React, { Component } from 'react'
import OldCycle from './OldCycle'
export default class App extends Component {
  state = {
    n:1,
    show:true
  }
  render() {
    const comp =this.state.show? <OldCycle n={this.state.n} />:null
    return (
     
      <>
     {comp}
      <button onClick={()=>{
        this.setState(state=>({
          n:state.n + 1
        }))
      }}>n+1</button>
      <button
      onClick={
        ()=>{
          this.setState({
            show:!this.state.show
          })
        }
      }
      >显示/隐藏</button>
      </>
    )
  }
}
